<template>
  <div class="studentInfo">
        <h1>学号:{{ studentInfo.studentnumber }}</h1>
        <el-divider></el-divider>
        <h1>系部:{{ studentInfo.department }}</h1>
        <el-divider></el-divider>
        <h1>专业:{{ studentInfo.major }}</h1>
        <el-divider></el-divider>
        <h1>班级:{{ studentInfo.classnumber }}</h1>
        <el-divider></el-divider>
        <h1>姓名:{{ studentInfo.studentname }}</h1>
  </div>
</template>

<script>
import axios from "axios";
import { path } from "../config.json";
export default {
  name: "studentInfo",
  data() {
    return {
      studentInfo: {
        studentid: 0,
        studentnumber: 0,
        department: "",
        major: "",
        classnumber: "",
        studentname: "",
      },
    };
  },
  mounted() {
    this.studentInfo.studentnumber = sessionStorage.getItem("account");
    axios({
      method: "post",
      url: path + "/student/getStudentInfo",
      params: {
        studentnumber: this.studentInfo.studentnumber,
      },
    })
      .then((response) => {
        if (Object.keys(response.data).length == 0) alert("null");
        this.studentInfo = response.data;
      })
      .catch(function (error) {
        ElMessage.error("与服务器通信失败，请重试！");
      });
  },
};
</script>

<style scoped>
.studentInfo{
  float: left;
  text-align: left;
}
.h_info {
  text-align: left;
}
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}

.box-card {
  width: 480px;
}
</style>